Longitudinal Mixed Model Workflow
Overview
A longitudinal mixed model workflow is a practical way to build linear mixed models for repeated measurements over time.
Core logic
Where is the variation?
-> How does the outcome change over time?
-> How do individuals differ in that change?
-> What explains those differences?
Build model complexity only when it corresponds to a meaningful scientific question.
Composite model form
For longitudinal data, level-1 and level-2 models can be combined into one equation.
For a random-intercept + random-slope model:
: population-average intercept / initial status : population-average rate of change : individual deviation in intercept : individual deviation in slope : within-person residual
The residual structure naturally induces dependence among repeated measurements from the same person.
Before modeling
Before fitting models, examine:
- outcome trajectories over time
- within-person vs. between-person variability
- plausible functional form of time
- missingness patterns
- irregular measurement schedules
The goal is to see whether systematic change and meaningful individual heterogeneity are present.
Model-building strategy
A useful strategy is to build the model gradually:
Each new model is interpreted relative to a simpler baseline.
1. Unconditional means model
No TIME or substantive predictors:
Purpose:
- estimate the overall mean
- partition variation into:
- between-person variance
- within-person variance
- determine whether meaningful outcome variation exists
- provide a baseline for later models
No systematic change over time is modeled yet.
2. Unconditional growth model
Add TIME:
Purpose:
- estimate the population-average trajectory
- determine whether individuals differ in:
- initial status
- rate of change
- assess how much within-person variation is explained by TIME
- estimate the intercept-slope covariance
A significant random-slope variance suggests meaningful heterogeneity in rates of change that may be explained by predictors.
3. Conditional growth model
Add substantive predictors based on the research question.
Predictors can be:
- time-invariant predictors
- time-varying predictors
Time-invariant predictors
A time-invariant predictor has one value for each individual.
Examples:
- sex
- genotype
- baseline age
- treatment group
- education level
Time-invariant predictors can explain individual differences in intercepts and/or slopes.
For example:
: effect of on initial status : effect of on rate of change
To explain differences in rates of change, include an interaction with TIME.
Time-varying predictors
A time-varying predictor can take different values for the same individual at different measurement occasions.
Examples:
- unemployment rate
- medication use
- blood pressure
- BMI
These predictors enter the level-1 model because they vary within individuals over time.
A simple form is:
where
Centering time-varying predictors
Time-varying predictors can be represented in several ways, depending on the research question.
Possible representations include:
- raw values
- deviation from the grand mean
- deviation from a meaningful constant
- deviation from each person's own mean
- deviation from each person's initial value
These representations can change the interpretation of model parameters even when the underlying information is similar.
For example, within-person centering uses:
This represents how much the predictor at occasion
This can help distinguish:
- between-person differences: people who generally have higher
- within-person changes: occasions when a person has higher or lower
than usual
The choice of centering should be driven by substantive interpretation rather than a universal rule.
Associations involving time-varying predictors can be difficult to interpret causally.
If
This is especially important when the individual's current outcome can influence the value of the predictor itself. See Causal inference.
Functional form of time
Time can be modeled in different ways:
- linear time
- polynomial time
- piecewise time
- spline-based time
- categorical time
- other nonlinear forms
Choose the simplest form that adequately represents the data and research question.
The meaning of the intercept depends heavily on how TIME is coded. If
Estimation & Model Comparison
Estimation
Mixed models can be estimated using methods such as:
- maximum likelihood estimation (MLE)
- full maximum likelihood (ML)
- restricted maximum likelihood (REML)
- generalized least squares (GLS)
- iterative generalized least squares
GLS = extending ordinary least squares by allowing residuals to be correlated and heteroscedastic, which is important for longitudinal data.
Comparing models
For models estimated by ML, model fit can be compared using deviance:
Smaller deviance indicates better fit.
For two nested models:
This can be tested approximately using a
This is the logic of the Likelihood ratio test.
Use ML, not REML, when comparing models that differ in fixed effects. REML is often preferred for estimating variance components in a final model.
Variance reduction and pseudo-
Variance components from simpler models can serve as baselines for evaluating later models.
For example:
This describes the proportional reduction in unexplained variance after adding predictors.
Different variance components can have different pseudo-
- level-1 residual variance
- random-intercept variance
- random-slope variance
Interpretation:
- reduced random-intercept variance → predictor explains some baseline heterogeneity
- reduced random-slope variance → predictor explains some heterogeneity in rates of change
- reduced level-1 residual variance → predictor explains some within-person variation
Pseudo-
Model assumptions and diagnostics
Important assumptions should be examined at both levels.
Functional form
- Level 1: check whether the assumed TIME trajectory fits individual growth patterns
- Level 2: check whether relationships between growth parameters and predictors have the assumed form
Residuals
Inspect residuals for:
- approximate normality
- homoscedasticity
- systematic patterns indicating model misspecification
- influential individual cases
Diagnostics are especially important for the final model being interpreted.
Interpretation
Fixed effects
Fixed effects describe the systematic population-level trajectory and predictor effects.
Examples:
- fixed intercept → expected outcome at the reference time point
- fixed effect of TIME → average rate of change
- predictor main effect → difference at the reference time point
- TIME × predictor interaction → difference in rate of change
Random effects
Random effects describe how individual trajectories deviate from the population-average trajectory.
Important variance components:
- random-intercept variance → heterogeneity in initial status
- random-slope variance → heterogeneity in rates of change
- intercept-slope covariance → association between baseline deviations and rate-of-change deviations
- residual variance → remaining within-person variation
Variance components represent remaining unexplained heterogeneity conditional on the current fixed effects.
Empirical Bayes estimates
Mixed models can estimate individual trajectories using model-based / empirical Bayes estimates.
These combine:
rather than estimating each person's trajectory independently with OLS.
The resulting individual estimates are usually shrunk toward the relevant population-average trajectory, especially when an individual's data are sparse or noisy.
This often improves precision, but the quality of empirical Bayes estimates depends on the correctness of the fitted model.
Practical workflow
First quantify variation, then model change over time, then explain individual differences in that change.
- Explore the longitudinal structure.
- Fit an unconditional means model.
- Add TIME to fit an unconditional growth model.
- Choose the functional form of TIME.
- Add substantive predictors.
- Decide how predictors should be centered or represented.
- Add interactions with TIME if the question concerns change.
- Examine variance reduction.
- Compare nested models when appropriate.
- Check assumptions and model fit.
- Interpret fixed effects, random effects, and variance components.